const mongoose = require('mongoose')
const { makePattern, Mongodb_LogText } = require('../utils/console_log')
mongoose.connect('mongodb://localhost:27017/chat')
// mongoose.connect('mongodb://127.0.0.1:27017/chat')

var db = mongoose.connection
db.on('error', console.error.bind(console, 'connection error:'))
db.once('open', function() {
  console.log(makePattern(Mongodb_LogText, 'green'));
  console.log('mongodb连接成功')
})